<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Cache;
use App\Models\Worklink;
use DB;

class Wxkfhanndle implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    protected $users_id;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($users_id)
    {
        $this->users_id = $users_id;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $workLinks = Worklink::userWorkLinkLists($this->users_id);
        foreach ($workLinks as $workLink) {
            Cache::forget('work_link_'.$workLink->kfid);
        }
    }
}
